<script setup>
import { RouterLink, RouterView } from "vue-router";
</script>

<template>
  <div class="header">
    <router-link to="/list" class="header-title">电商网站示例</router-link>
    <div class="header-menu">
      <router-link to="/cart" class="header-menu-cart">
        购物车
        <span v-if="count">{{ count }}</span>
      </router-link>
    </div>
  </div>
  <router-view></router-view>
</template>

<script>
import { mapState } from "pinia";
import { useCartStore } from "@/store";

export default {
  computed: {
    ...mapState(useCartStore, ["count"]),
  },
};
</script>
